package one;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

public class FindRepeat {

	public static void main(String[] args) {
		getFileList("C:\\");
	}

	public static void getFileList(String path){

		List<String> list = new ArrayList<String>();
		File f = new File(path);
		String[] name = f.list();
		for (int i = 0; i < name.length; i++) {
			String tempName = name[i];
			int index = tempName.indexOf("-", 4);
			if (index >= 0) {
				String temp = tempName.substring(0, index);
				list.add(temp);
			}
		}
		String  [] arr = list.toArray(new String[list.size()]);
 		RepeatNum(arr);
	}
	public static void RepeatNum(String[] arr) {
		int i, j;
		int len = arr.length;
		for (i = 0; i < len; i++) {
			for (j = i+1 ; j < len; j++) {
				if (arr[i].equals(arr[j])) {
					System.out.println(arr[i]);
				}
			}
		}
	}
}
